import { QXEvent } from 'qx-util';
import { IParam, IViewCtx } from '../../common';
import { IControllerParams, ILoadingHelper } from '../../modules';
import { ICtrlAbility } from '../ability';
import { ICtrlDataAction } from '../data-action/i-ctrl-data-action';
import { CtrlActionType, ICtrlEvent } from '../event';

/**
 * 部件控制器参数
 *
 * @export
 * @interface ICtrlControllerParams
 */
export interface ICtrlControllerParams<T, A extends ICtrlAbility>
	extends IControllerParams {
	/**
	 * 模型数据
	 *
	 * @type {IParam}
	 * @memberof ICtrlControllerParams
	 */
	model: IParam;

	/**
	 * 部件数据行为
	 *
	 * @type {ICtrlDataAction}
	 * @memberof ICtrlControllerParams
	 */
	actions?: ICtrlDataAction;

	/**
	 * 部件事件
	 *
	 * @type {QXEvent<IWidgetEvent>}
	 * @memberof ICtrlControllerParams
	 */
	evt: QXEvent<ICtrlEvent<T | CtrlActionType, A>>;

	/**
	 * 关闭视图
	 *
	 * @type {Function}
	 * @memberof ICtrlControllerParams
	 */
	closeView: Function | undefined;

	/**
	 * 父加载助手
	 *
	 * @type {ILoadingHelper}
	 * @memberof ICtrlControllerParams
	 */
	pLoadingHelper?: ILoadingHelper;

	/**
	 * 父viewCtx
	 *
	 * @type {IViewCtx}
	 * @memberof ICtrlControllerParams
	 */
	pViewCtx?: IViewCtx;
}
